package net.oschina.archx.spring.entity;

import net.oschina.archx.spring.validate.group.UserGroup;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.GroupSequence;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * User
 *
 * @author Archx
 * @date 2015/8/4
 */
@GroupSequence({UserGroup.A.class, UserGroup.B.class, User.class})
public class User implements Serializable {

    private static final long serialVersionUID = 7006903563600208430L;

    private Long id;

    @NotBlank(message = "{user.name.null}", groups = UserGroup.A.class)
    @Length(min = 3, max = 10, message = "{user.name.length}", groups = UserGroup.B.class)
    private String name;

    @NotNull(message = "没有年龄", groups = UserGroup.A.class)
    private Integer age;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
